#!/usr/bin/perl
# bf2.pl
# 01.19.2009
# Browser Fuzzer 2
#
#       Krakow Labs Development [krakowlabs.com] -> bf2
#     "Browser Fuzzer 2 -- The bugs cannot hide anymore"
#     rush@KL (Jeremy Brown) [rush[at]krakowlabs[dot]com]
#
# Associated Files & Information:
# http://www.krakowlabs.com/dev/fuz/bf2/bf2.pl.txt
# http://www.krakowlabs.com/dev/fuz/bf2/bf2_doc.txt
# http://www.krakowlabs.com/dev/fuz/bf2/bf2.tar.gz
# http://www.krakowlabs.com/dev/fuz/bf2/bf2.jpeg
# bf2.pl

use Getopt::Std;

# FUZZ DATA BEGIN HERE [_Jeremy Brown_ 3rd Generation Fuzzing Oracle [unlimited style, web] _Jeremy Brown_] 116
@overflows = ('A' x 4200, 'A' x 8500,  'A' x 22000, 'A' x 52000, 'A' x 120000, 'A' x 500500,
	      'A' x 1200000, 'A' x 20000000, '//AAAA' x 5000, '\\\AAAA' x 5000, '\0x99' x 12000,
	      'http://' . 'A' x 4200, 'http://' . 'A' x 12000, 'http://' . 'A' x 500500, 'http://' . 'A' x 5005000, 'http://' . 'A' x 200000,
		  'http://' . './A' x 120000,'http://'.'../' x 120000,
	      'www.' . 'A' x 5005000 . '.com','^' x 12000,'./#' x 12000,'@' x 12000,'//'.'A' x 12000 . '/sss','//'.'../' x 12000 . '/sss',
	      'A/' x 2100, 'A/' x 6000, 'A/' x 250250, 'A/' x 2502500,'/' x 6000,'%x' x 6000,'#' x 6000,'/x' x 6000,'/.'x 6000); # 30

@fmtstring = ('%n%n%n%n%n', '%p%p%p%p%p', '%s%s%s%s%s', '%d%d%d%d%d', '%x%x%x%x%x',
              '%s%p%x%d', '%.1024d', '%.1025d', '%.2048d', '%.2049d', '%.4096d', '%.4097d',
              '%99999999999s', '%08x', '%%20n', '%%20p', '%%20s', '%%20d', '%%20x', 
              '%#0123456x%08x%x%s%p%d%n%o%u%c%h%l%q%j%z%Z%t%i%e%g%f%a%C%S%08x%%', '\0xCD' x 50, '\0xCB' x 50); # 22

@numbers   = ('0', '-0', '1', '-1', '32767', '-32768', '2147483647', '-2147483647', '2147483648', '-2147483648',
              '4294967294', '4294967295', '4294967296', '357913942', '-357913942', '536870912', '-536870912', '5e-324', '1.79769313486231E+308', '3.39519326559384E-313',
	      '99999999999', '-99999999999', '0x100', '0x1000', '0x3fffffff', '0x7ffffffe', '0x7fffffff', '0x80000000', '0xffff', '0xfffffffe',
	      '0xfffffff', '0xffffffff', '0x10000', '0x100000', '0x99999999', '65535', '65536', '65537', '16777215', '16777216',
	      '16777217', '-268435455'); # 42

@miscbugs  = ('test|net user >h:\cmd.txt|test', 'test`net user >h:\cmd.txt`test', 'test\'net user >h:\cmd.txt\'test', 'test;net user >h:\cmd.txt;test', 'test&&net user >h:\cmd.txt&&test',
	      'test|c:/windows/system32/calc.exe|test', 'test`c:/windows/system32/calc.exe`test', 'test\'c:/windows/system32/calc.exe\'test', 'test;c:/windows/system32/calc.exe;test', 'c:/windows/system32/calc.exe',
	      '|c:/windows/system32/calc.exe|', '`c:/windows/system32/calc.exe`', '../..\\' x 500, '%0xa', '%u000', '`~@#$', '%^&*()', '-=_+', '[]\{}', '|;\':"', 
	      ',./<>', '?' x 12000); # 22
# FUZZ DATA END HERE [_Jeremy Brown_ 3rd Generation Fuzzing Oracle [unlimited style, web] _Jeremy Brown_] 116

# DOM BEGIN
@domwindow    = ('outerHeight', 'outerWidth', 'status', 'moveBy', 'moveTo', 'resizeBy', 'resizeTo', 'scrollBy', 'scrollTo', 'setInterval', 'setTimeout'); # do <body onload="window.x=x"> (first 3) & others <body onload="window.x(x,x)"> -- window.resizeX/scrollX has 2 params & setX has 2
@domdocument  = ('cookie', 'getElementById', 'getElementsByName', 'getElementsByTagName', 'open', 'write', 'writeIn'); # open can have 2 params
@domhistory   = ('go');
@domlocation  = ('hash', 'host', 'hostname', 'href', 'pathname', 'port', 'protocol', 'search', 'assign', 'replace');
# DOM END

# HTML BEGIN
@htmliframe  = ('ABBR','ACCEPT','ACCEPTCHARSET','ACTION','ADDITIVE','allowTransparency','ALT','APPLICATION','ARCHIVE','ATOMICSELECTION','AXIS','BALANCE');
# HTML END


# JavaScript BEGIN
@jstlfuncs     = ('decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent', 'escape', 'unescape', 'eval', 'isFinite', 'inNaN', 'Number', 'parseFloat', 'parseInt', 'String');
@jsstringmtds  = ('strng.anchor', 'strng.charAt', 'strng.charCodeAt', 'strng.concat', 'strng.fontcolor', 'strng.fontsize', 'strng.fromCharCode', 'strng.indexOf', 'strng.lastIndexOf', 'strng.link',
		 'strng.link', 'strng.match', 'strng.replace', 'strng.search', 'strng.slice', 'strng.split', 'strng.substr', 'strng.substring');
@jsdatemtds    = ('Date.parse', 'dte.setDate', 'dte.setFullYear', 'dte.setHours', 'dte.setMilliseconds', 'dte.setMinutes', 'dte.setMonth', 'dte.Seconds', 'dte.setTime', 'dte.setUTCDate', 
		 'dte.setUTCMonth', 'dte.setUTCFullYear', 'dte.setUTCHours', 'dte.setUTCMinutes', 'dte.setUTCSeconds', 'dte.setUTCMilliseconds', 'dte.setYear');
@jsmathmtds    = ('Math.abs', 'Math.acos', 'Math.asin', 'Math.atan', 'Math.atan2', 'Math.ceil', 'Math.cos', 'Math.exp', 'Math.floor', 'Math.log', 'Math.max', 'Math.min',
		 'Math.pow', 'Math.round', 'Math.sin', 'Math.sqrt', 'Math.tan');
@jsnumbermtds  = ('numbr.toExponential', 'numbr.toFixed', 'numbr.toPercision', 'numbr.toString');
# JavaScript END

$cssbegin     = '<style type="text/css">';
$cssend       = '</style>' . "\n" . '</head>';

$htmlbegin    = '<html>';
$htmlend      = '</html>';

$scriptbegin  = '<script type="text/javascript">';
$scriptend    = '</script>';
$jsvarstrng   = 'var strng = "test";';
$jsvardte     = 'var dte = new Date();';
$jsvarnumbr   = 'var numbr = new Number(1000);';

$refresh1     = '<head><meta http-equiv="refresh" content="1; url=';
$refresh2     = '"></head>';

getopts('o:p:', \%opts);
$output  = $opts{'o'};
$phase   = $opts{'p'};

if(!defined($output) || !defined($phase))
{
     print "\n       Krakow Labs Development [krakowlabs.com] -> bf2";
     print "\n     \"Browser Fuzzer 2 -- The bugs cannot hide anymore\"";
     print "\n     rush\@KL (Jeremy Brown) [rush[at]krakowlabs[dot]com]\n";
     print "\n       Usage: $0 -o <output directory> -p [phase]\n";
     print "\n[phase   one]  ->  CSS Fuzzing  (Cascading Style Sheets, Inline Style, Core Parsing)";
     print "\n[phase   two]  ->  DOM Fuzzing  (Document Object Model, HTML/JS DOM Objects)";
     print "\n[phase three]  ->  HTML Fuzzing (HyperText Markup Language, Tags & Attributes)";
     print "\n[phase  four]  ->  JS Fuzzing   (JavaScript, Top Level Functions & Methods)";
     print "\n\nExample: $0 -o /var/www/apache2 -p 3 (now break out your favorite browser and fuzz it :)\n\n";
     exit(0);

}

     print "\n       Krakow Labs Development [krakowlabs.com] -> bf2";
     print "\n     \"Browser Fuzzer 2 -- The bugs cannot hide anymore\"";
     print "\n     rush\@KL (Jeremy Brown) [rush[at]krakowlabs[dot]com]\n";

$c = 1; $i = 1;

if($phase == '1')
{

     print "\nbf2[phase one] CSS Process Engaged. This could take some time (and disc space)!\n\n";

print "[STAGE-> $i] Writing <selector> fuzz data to $output\n";
foreach(@overflows)    { $fuzz = $_; csscreate1($output, $c, $htmlbegin, $refresh1, $cssbegin, $fuzz, $cssend, $htmlend); $c++; }
foreach(@fmtstring)    { $fuzz = $_; csscreate1($output, $c, $htmlbegin, $refresh1, $cssbegin, $fuzz, $cssend, $htmlend); $c++; }
foreach(@numbers)      { $fuzz = $_; csscreate1($output, $c, $htmlbegin, $refresh1, $cssbegin, $fuzz, $cssend, $htmlend); $c++; }
foreach(@miscbugs)     { $fuzz = $_; csscreate1($output, $c, $htmlbegin, $refresh1, $cssbegin, $fuzz, $cssend, $htmlend); $c++; } $i++;

print "[STAGE-> $i] Writing <property> fuzz data to $output\n";
foreach(@overflows)    { $fuzz = $_; csscreate2($output, $c, $htmlbegin, $refresh1, $cssbegin, $fuzz, $cssend, $htmlend); $c++; }
foreach(@fmtstring)    { $fuzz = $_; csscreate2($output, $c, $htmlbegin, $refresh1, $cssbegin, $fuzz, $cssend, $htmlend); $c++; }
foreach(@numbers)      { $fuzz = $_; csscreate2($output, $c, $htmlbegin, $refresh1, $cssbegin, $fuzz, $cssend, $htmlend); $c++; }
foreach(@miscbugs)     { $fuzz = $_; csscreate2($output, $c, $htmlbegin, $refresh1, $cssbegin, $fuzz, $cssend, $htmlend); $c++; } $i++;

print "[STAGE-> $i] Writing <value>    fuzz data to $output\n";
foreach(@overflows)    { $fuzz = $_; csscreate3($output, $c, $htmlbegin, $refresh1, $cssbegin, $fuzz, $cssend, $htmlend); $c++; }
foreach(@fmtstring)    { $fuzz = $_; csscreate3($output, $c, $htmlbegin, $refresh1, $cssbegin, $fuzz, $cssend, $htmlend); $c++; }
foreach(@numbers)      { $fuzz = $_; csscreate3($output, $c, $htmlbegin, $refresh1, $cssbegin, $fuzz, $cssend, $htmlend); $c++; }
foreach(@miscbugs)     { $fuzz = $_; csscreate3($output, $c, $htmlbegin, $refresh1, $cssbegin, $fuzz, $cssend, $htmlend); $c++; } $i++;

     $fcnt = $c-1;
     print "\nbf2[phase one] CSS Process Complete (Final Count: $fcnt). Point your browser to $output/css1.html and monitor for exceptions :)\n\n";

}

if($phase == '2')
{

     print "\nbf2[phase two] DOM Process Engaged. This could take some time (and disc space)!\n\n";

print "[STAGE-> $i] Writing <document> fuzz data to $output\n";
foreach(@domdocument)  { $object  = 'document'; $method = $_;
foreach(@overflows)    { $fuzz = $_; domcreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $object, $method, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@fmtstring)    { $fuzz = $_; domcreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $object, $method, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@numbers)      { $fuzz = $_; domcreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $object, $method, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@miscbugs)     { $fuzz = $_; domcreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $object, $method, $fuzz, $scriptend, $htmlend); $c++; } } $i++;

print "[STAGE-> $i] Writing <window>   fuzz data to $output\n";
foreach(@domwindow)    { $object  = 'window'; $method = $_;
foreach(@overflows)    { $fuzz = $_; domcreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $object, $method, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@fmtstring)    { $fuzz = $_; domcreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $object, $method, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@numbers)      { $fuzz = $_; domcreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $object, $method, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@miscbugs)     { $fuzz = $_; domcreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $object, $method, $fuzz, $scriptend, $htmlend); $c++; } } $i++;

print "[STAGE-> $i] Writing <history>  fuzz data to $output\n";
foreach(@domhistory)   { $object  = 'history'; $method = $_;
foreach(@overflows)    { $fuzz = $_; domcreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $object, $method, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@fmtstring)    { $fuzz = $_; domcreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $object, $method, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@numbers)      { $fuzz = $_; domcreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $object, $method, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@miscbugs)     { $fuzz = $_; domcreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $object, $method, $fuzz, $scriptend, $htmlend); $c++; } } $i++;

print "[STAGE-> $i] Writing <location> fuzz data to $output\n";
foreach(@domlocation)  { $object  = 'location'; $method = $_;
foreach(@overflows)    { $fuzz = $_; domcreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $object, $method, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@fmtstring)    { $fuzz = $_; domcreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $object, $method, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@numbers)      { $fuzz = $_; domcreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $object, $method, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@miscbugs)     { $fuzz = $_; domcreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $object, $method, $fuzz, $scriptend, $htmlend); $c++; } } $i++;

     $fcnt = $c-1;
     print "\nbf2[phase two] DOM Process Complete (Final Count: $fcnt). Point your browser to $output/dom1.html and monitor for exceptions :)\n\n";

}

if($phase == '3')
{

     print "\nbf2[phase three] HTML Process Engaged. This could take some time (and disc space)!\n\n";

print "[STAGE->$i] Writing <iframe>    fuzz data to $output\n";
foreach(@htmliframe)   { $tag  = 'iframe'; $attr = $_;
foreach(@overflows)    { $fuzz = $_; htmlcreate($output, $c, $htmlbegin, $refresh1, $refresh2, $tag, $attr, $fuzz, $htmlend); $c++; }
foreach(@fmtstring)    { $fuzz = $_; htmlcreate($output, $c, $htmlbegin, $refresh1, $refresh2, $tag, $attr, $fuzz, $htmlend); $c++; }
foreach(@numbers)      { $fuzz = $_; htmlcreate($output, $c, $htmlbegin, $refresh1, $refresh2, $tag, $attr, $fuzz, $htmlend); $c++; }
foreach(@miscbugs)     { $fuzz = $_; htmlcreate($output, $c, $htmlbegin, $refresh1, $refresh2, $tag, $attr, $fuzz, $htmlend); $c++; } } $i++;

       $fcnt = $c-1;
     print "\nbf2[phase three] HTML Process Complete (Final Count: $fcnt). Point your browser to $output/html1.html and monitor for exceptions :)\n\n";

}

if($phase == '4')
{

     print "\nbf2[phase four] JS Process Engaged. This could take some time (and disc space)!\n\n";

print "[STAGE-> $i] Writing <jstlfuncs>     fuzz data to $output\n";
foreach(@jstlfuncs)     { $funcmthd = $_;
foreach(@overflows)     { $fuzz = $_; jscreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $jsvarstrng, $funcmthd, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@fmtstring)     { $fuzz = $_; jscreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $jsvarstrng, $funcmthd, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@numbers)       { $fuzz = $_; jscreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $jsvarstrng, $funcmthd, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@miscbugs)      { $fuzz = $_; jscreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $jsvarstrng, $funcmthd, $fuzz, $scriptend, $htmlend); $c++; } } $i++;

print "[STAGE-> $i] Writing <jsstringmthds> fuzz data to $output\n";
foreach(@jsstringmtds)  { $funcmthd = $_;
foreach(@overflows)     { $fuzz = $_; jscreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $jsvarstrng, $funcmthd, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@fmtstring)     { $fuzz = $_; jscreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $jsvarstrng, $funcmthd, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@numbers)       { $fuzz = $_; jscreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $jsvarstrng, $funcmthd, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@miscbugs)      { $fuzz = $_; jscreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $jsvarstrng, $funcmthd, $fuzz, $scriptend, $htmlend); $c++; } } $i++;

print "[STAGE-> $i] Writing <jsdatemthds>   fuzz data to $output\n";
foreach(@jsdatemtds)    { $funcmthd = $_;
foreach(@overflows)     { $fuzz = $_; jscreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $jsvardte, $funcmthd, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@fmtstring)     { $fuzz = $_; jscreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $jsvardte, $funcmthd, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@numbers)       { $fuzz = $_; jscreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $jsvardte, $funcmthd, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@miscbugs)      { $fuzz = $_; jscreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $jsvardte, $funcmthd, $fuzz, $scriptend, $htmlend); $c++; } } $i++;

print "[STAGE-> $i] Writing <jsmathmthds>   fuzz data to $output\n";
foreach(@jsmathmtds)    { $funcmthd = $_;
foreach(@overflows)     { $fuzz = $_; jscreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $jsvarstrng, $funcmthd, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@fmtstring)     { $fuzz = $_; jscreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $jsvarstrng, $funcmthd, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@numbers)       { $fuzz = $_; jscreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $jsvarstrng, $funcmthd, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@miscbugs)      { $fuzz = $_; jscreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $jsvarstrng, $funcmthd, $fuzz, $scriptend, $htmlend); $c++; } } $i++;

print "[STAGE-> $i] Writing <jsnumbermthds> fuzz data to $output\n";
foreach(@jsnumbermtds)  { $funcmthd = $_;
foreach(@overflows)     { $fuzz = $_; jscreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $jsvarnumbr, $funcmthd, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@fmtstring)     { $fuzz = $_; jscreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $jsvarnumbr, $funcmthd, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@numbers)       { $fuzz = $_; jscreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $jsvarnumbr, $funcmthd, $fuzz, $scriptend, $htmlend); $c++; }
foreach(@miscbugs)      { $fuzz = $_; jscreate($output, $c, $htmlbegin, $refresh1, $refresh2, $scriptbegin, $jsvarnumbr, $funcmthd, $fuzz, $scriptend, $htmlend); $c++; } } $i++;

     $fcnt = $c-1;
     print "\nbf2[phase four] JS Process Complete (Final Count: $fcnt). Point your browser to $output/js1.html and monitor for exceptions :)\n\n";

}

sub csscreate1 { #selector
		$ccoutput      = $_[0];
		$ccc           = $_[1];
		$cchtmlbegin   = $_[2];
		$ccrefresh     = $_[3];
		$cccssbegin    = $_[4];
		$ccfuzz        = $_[5];
		$cccssend      = $_[6];
		$cchtmlend     = $_[7];

     $ccfilename  = '>' . $ccoutput . '/' . 'css' . $ccc . '.html';
     $ccfnl       = $ccc + 1;
     $ccrefreshfn = 'css' . $ccfnl . '.html';

     $ccdata      = $cchtmlbegin . "\n" . $ccrefresh . $ccrefreshfn . '">' . "\n" . $cccssbegin . "\n" . $ccfuzz . ' {alink: blue}' . "\n" . $cccssend . "\n" . $cchtmlend;
     open(FILE, $ccfilename); print FILE $ccdata; close(FILE);
}

sub csscreate2 { # property
		$ccoutput      = $_[0];
		$ccc           = $_[1];
		$cchtmlbegin   = $_[2];
		$ccrefresh     = $_[3];
		$cccssbegin    = $_[4];
		$ccfuzz        = $_[5];
		$cccssend      = $_[6];
		$cchtmlend     = $_[7];

     $ccfilename  = '>' . $ccoutput . '/' . 'css' . $ccc . '.html';
     $ccfnl       = $ccc + 1;
     $ccrefreshfn = 'css' . $ccfnl . '.html';

     $ccdata      = $cchtmlbegin . "\n" . $ccrefresh . $ccrefreshfn . '">' . "\n" . $cccssbegin . "\n" . 'body {' . $ccfuzz . ': blue}' . "\n" . $cccssend . "\n" . $cchtmlend;
     open(FILE, $ccfilename); print FILE $ccdata; close(FILE);
}

sub csscreate3 { # value
		$ccoutput      = $_[0];
		$ccc           = $_[1];
		$cchtmlbegin   = $_[2];
		$ccrefresh     = $_[3];
		$cccssbegin    = $_[4];
		$ccfuzz        = $_[5];
		$cccssend      = $_[6];
		$cchtmlend     = $_[7];

     $ccfilename  = '>' . $ccoutput . '/' . 'css' . $ccc . '.html';
     $ccfnl       = $ccc + 1;
     $ccrefreshfn = 'css' . $ccfnl . '.html';

     $ccdata      = $cchtmlbegin . "\n" . $ccrefresh . $ccrefreshfn . '">' . "\n" . $cccssbegin . "\n" . 'body {alink: ' . $ccfuzz . '}' . "\n" . $cccssend . "\n" . $cchtmlend;
     open(FILE, $ccfilename); print FILE $ccdata; close(FILE);
}

sub domcreate {
		$dcoutput      = $_[0];
		$dcc           = $_[1];
		$dchtmlbegin   = $_[2];
		$dcrefresh1    = $_[3];
		$dcrefresh2    = $_[4];
		$dcscriptbegin = $_[5];
		$dcobject      = $_[6];
		$dcmethod      = $_[7];
		$dcfuzz        = $_[8];
		$dcscriptend   = $_[9];
		$dchtmlend     = $_[10];

     $dcfilename  = '>' . $dcoutput . '/' . 'dom' . $dcc . '.html';
     $dcfnl       = $dcc + 1;
     $dcrefreshfn = 'dom' . $dcfnl . '.html';

     $dcdata      = $dchtmlbegin . "\n" . $dcrefresh1 . $dcrefreshfn . $dcrefresh2 . "\n" . $dcscriptbegin . "\n" . $dctag . '.' . $dcattr . ' ="' . $dcfuzz . '";' . "\n" . $dcscriptend . "\n" . $dchtmlend;
     open(FILE, $dcfilename); print FILE $dcdata; close(FILE);
}

sub htmlcreate {
		 $hcoutput    = $_[0];
		 $hcc         = $_[1];
		 $hchtmlbegin = $_[2];
		 $hcrefresh1  = $_[3];
		 $hcrefresh2  = $_[4];
		 $hctag       = $_[5];
		 $hcattr      = $_[6];
		 $hcfuzz      = $_[7];
		 $hchtmlend   = $_[8];

     $hcfilename  = '>' . $hcoutput . '/' . 'html' . $hcc . '.html';
     $hcfnl       = $hcc + 1;
     $hcrefreshfn = 'html' . $hcfnl . '.html';

     $hcdata      = $hchtmlbegin . "\n" . $hcrefresh1 . $hcrefreshfn . $hcrefresh2 . "\n" . '<' . $hctag . ' ' . $hcattr . '="' . $hcfuzz . '">' . "\n" . $hchtmlend;
     open(FILE, $hcfilename); print FILE $hcdata; close(FILE);
}

sub jscreate {
	       $jcoutput      = $_[0];
	       $jcc           = $_[1];
               $jchtmlbegin   = $_[2];
	       $jcrefresh1    = $_[3];
	       $jcrefresh2    = $_[4];
	       $jcscriptbegin = $_[5];
	       $jcjsvar       = $_[6];
	       $jcfuncmthd    = $_[7];
	       $jcfuzz        = $_[8];
	       $jcscriptend   = $_[9];
	       $jchtmlend     = $_[10];

     $jcfilename  = '>' . $jcoutput . '/' . 'js' . $jcc . '.html';
     $jcfnl       = $jcc + 1;
     $jcrefreshfn = 'js' . $jcfnl . '.html';

     $jcdata      = $jchtmlbegin . "\n" . $jcrefresh1 . $jcrefreshfn . $jcrefresh2 . "\n" . $jcscriptbegin . "\n" . $jcjsvar . "\n" . $jcfuncmthd . '("' . $jcfuzz . '");' . "\n" . $jcscriptend . "\n" . $jchtmlend;
     open(FILE, $jcfilename); print FILE $jcdata; close(FILE);
}
